package edu.towson.cosc603.coffeemaker;
 

 
import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After; 
import org.junit.Before;
import org.junit.Test;
 
public class RecipeTest extends TestCase {
	 private Recipe recipe1;
	 private Recipe recipe2;
	 @Before

     public void setUp() throws Exception{

    	 new CoffeeMaker(); 
             recipe1 = new Recipe();
             recipe1.setName("coffee");
             recipe1.setAmtChocolate(1);
             recipe1.setAmtCoffee(2);
             recipe1.setAmtMilk(3);
             recipe1.setAmtSugar(4);
             recipe1.setPrice(5);
             
             
             recipe2 = new Recipe();
             recipe2.setName("coffee1");
             recipe2.setAmtChocolate(-1);
             recipe2.setAmtCoffee(-2);
             recipe2.setAmtMilk(-3);
             recipe2.setAmtSugar(-4);
             recipe2.setPrice(-5);
             
           
     }

     @After
     public void tearDown() throws Exception{
             recipe1 = null;
     }
     
     public void testsetAmtChocolate(){  	 
    	 assertEquals(1,recipe1.getAmtChocolate(),1.00);
    	 assertEquals(0,recipe2.getAmtChocolate()); 	 
     }
     
     public void testsetAmtCoffee(){  	 
    	 assertEquals(2,recipe1.getAmtCoffee(),2.00);
    	 assertEquals(0,recipe2.getAmtCoffee()); 	 
     }
     
     public void testsetAmtMilk(){  	 
    	 assertEquals(3,recipe1.getAmtMilk(),3.00);
    	 assertEquals(0,recipe2.getAmtMilk()); 	 
     }
     public void testsetAmtSugar(){  	 
    	 assertEquals(4,recipe1.getAmtSugar(),4.00);
    	 assertEquals(0,recipe2.getAmtSugar()); 	 
     }
     public void testgetprice(){  	 
    	 assertEquals(5,recipe1.getPrice(),5.00);
    	 assertEquals(0,recipe2.getPrice()); 	 
     }
     
     public void testgetname(){  	 
    	 assertEquals(5,recipe1.getPrice(),5.00);
    	 	 
     }
     public void testtoString() {
    	 
         assertSame("coffee", recipe1.toString());
  
         }
     public void testtoequals(){
       recipe1.setName( null );

         assertEquals( false,recipe1.equals(recipe1));
         
         assertEquals( true,recipe2.equals(recipe2));
         assertEquals( false,recipe1.equals(this.recipe1));

     }
} 
